package server;

import gen.UserService;

import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TServer.AbstractServerArgs;
import org.apache.thrift.server.TServer.Args;
import org.apache.thrift.server.TSimpleServer;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TServerTransport;

public class Server {
	public static void main(String[] args) {
		try {
			UserServiceHandler handler = new UserServiceHandler();
			UserService.Processor processor = new UserService.Processor(handler);
			TServerTransport serverTransport = new TServerSocket(9090);

			Args args2 = new Args(serverTransport);
			args2.processor(processor);
			TServer server = new TSimpleServer(args2);

			// Use this for a multithreaded server
			// server = new TThreadPoolServer(processor, serverTransport);
			System.out.println("Starting the server...");
			server.serve();
		} catch (Exception x) {
			x.printStackTrace();
		}
		System.out.println("done.");
	}
}